package cn.gson.springmvc.model.pojos;

import javax.persistence.*;
import java.sql.Date;
import java.util.Collection;
import java.util.Objects;

@Entity
public class Diagdoctor {
    private int diagdoctorId;
    private String diagdoctorContent;
    private Integer diagdoctorState;
    private Date diagdoctorStart;
    private Date diagdoctorEnddate;
    private Collection<Electpres> electpresByDiagdoctorId;

    @Id
    @Column(name = "diagdoctor_id", nullable = false)
    public int getDiagdoctorId() {
        return diagdoctorId;
    }

    public void setDiagdoctorId(int diagdoctorId) {
        this.diagdoctorId = diagdoctorId;
    }

    @Basic
    @Column(name = "diagdoctor_content", nullable = true, length = 200)
    public String getDiagdoctorContent() {
        return diagdoctorContent;
    }

    public void setDiagdoctorContent(String diagdoctorContent) {
        this.diagdoctorContent = diagdoctorContent;
    }

    @Basic
    @Column(name = "diagdoctor_state", nullable = true)
    public Integer getDiagdoctorState() {
        return diagdoctorState;
    }

    public void setDiagdoctorState(Integer diagdoctorState) {
        this.diagdoctorState = diagdoctorState;
    }

    @Basic
    @Column(name = "diagdoctor_start", nullable = true)
    public Date getDiagdoctorStart() {
        return diagdoctorStart;
    }

    public void setDiagdoctorStart(Date diagdoctorStart) {
        this.diagdoctorStart = diagdoctorStart;
    }

    @Basic
    @Column(name = "diagdoctor_enddate", nullable = true)
    public Date getDiagdoctorEnddate() {
        return diagdoctorEnddate;
    }

    public void setDiagdoctorEnddate(Date diagdoctorEnddate) {
        this.diagdoctorEnddate = diagdoctorEnddate;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Diagdoctor that = (Diagdoctor) o;
        return diagdoctorId == that.diagdoctorId &&
                Objects.equals(diagdoctorContent, that.diagdoctorContent) &&
                Objects.equals(diagdoctorState, that.diagdoctorState) &&
                Objects.equals(diagdoctorStart, that.diagdoctorStart) &&
                Objects.equals(diagdoctorEnddate, that.diagdoctorEnddate);
    }

    @Override
    public int hashCode() {
        return Objects.hash(diagdoctorId, diagdoctorContent, diagdoctorState, diagdoctorStart, diagdoctorEnddate);
    }

    @OneToMany(mappedBy = "diagdoctorByDiagdoctorId")
    public Collection<Electpres> getElectpresByDiagdoctorId() {
        return electpresByDiagdoctorId;
    }

    public void setElectpresByDiagdoctorId(Collection<Electpres> electpresByDiagdoctorId) {
        this.electpresByDiagdoctorId = electpresByDiagdoctorId;
    }
}
